/**
 * Created by yudongyang on 2016/3/2 11:20.
 * mail: yudongyang@kehaoinfo.com
 **/

package com.wujie.activies.controller.exchangeBean;

import com.alibaba.fastjson.JSON;

/**
 * Created by yudongyang on 2016/3/2.
 *  返回普通操作JSON数据的标准格式
 *  @see com.wujie.activies.controller.exchangeBean.JSONPageData
 */
public class JSONData<T> {

    //状态码
    // 小于0统一表示失败，大于0表示成功
    private int code;
    //描述信息
    private String desc;
    //实际数据
    private T data;

    //默认成功
    public JSONData(){
        code = 1;
        desc = "操作成功";
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.code = 1;
        this.desc = desc;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.code = 1;
        this.data = data;
    }

    @Override
    public String toString(){
        return JSON.toJSONString(this);
    }
}
